home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / prog_c / kbstf10.zip / README.TXT < prev    next >
Text File  |  1996-04-03  |  12KB  |  264 lines

  1. The file kbstf10.zip contains some keyboard utilities by Luigi Mancinelli.
  2.  
  3.    KBSTUFF.C
  4.    KBSTUFF.COM
  5.    KBSTUFFR.C
  6.    KBSTUFFR.COM
  7.    SEEKBBUF.C
  8.    SEEKBBUF.COM
  9.  
  10.    KBSTFRES\KBSTFRES.ASM
  11.    KBSTFRES\KBSTFRES.COM
  12.  
  13.    DISKBD\DISKBD.ASM
  14.    DISKBD\DISKBD.COM
  15.    DISKBD\UNINSTKL.C
  16.    DISKBD\UNINSTKL.COM
  17.  
  18.    KBRESDIS\KBRESDIS.ASM
  19.    KBRESDIS\KBRESDIS.COM
  20.    KBRESDIS\KBDOSRES.C
  21.    KBRESDIS\KBDOSRES.COM
  22.  
  23.    README.TXT -- This file
  24.  
  25.    The C sources are written for Borland Turbo C 2.0 and could require even
  26. a lot of work to be compiled with different versions of C. They are plain C
  27. and maybe could be easily translated in assembler, because  they  don't use
  28. tipical C functions.
  29.  The asm programs are written to be assembled with the exclusive use of the
  30. DOS Debug and they are not easily converted to masm sources.  The shareware
  31. program A86 of Eric Isaacson can be used instead.
  32.  The philosophy I've adopted is to create very short TSRs, with  a  minimal
  33. initialization code, and  to delegate  the most of  work to C programs that
  34. communicate with the TSRs.  This is possible complying, for TSRs that  trap
  35. interrupts, with the IBM's INTERRUPT sharing protocol.
  36.  
  37.   Thanks a lot to Chris Dunford  for  posting informations about IBM's
  38.  INTERRUPT-SHARING PROTOCOL.
  39.  
  40. +++++++++++++++++++++++++
  41. SEEKBBUF.C - SEEKBBUF.COM
  42.   This program can be used to inspect the keyboard buffer used by  the
  43.  the standard  INT 9h handler, which is a circular  buffer  of 2-bytes
  44.  words.
  45.   The buffer must reside in the BIOS data segment (040h:0).  At offset
  46.  80h must be found the offset of the first byte  of the buffer, at 82h
  47.  there should be the offset of the first byte after the buffer.   This
  48.  should be standard,but could happen that old BIOSes don't comply with
  49.  this.
  50.  
  51.   Syntax:
  52.   SEEKBBUF
  53.  
  54.   Press <ESC> to exit from program.
  55.  
  56.   (c) 1996 by Luigi Mancinelli
  57.   manci@alpha.science.unitn.it
  58.  
  59.  
  60.  
  61. +++++++++++++++++++++++
  62. KBSTUFF.C - KBSTUFF.COM
  63.   This program stuffs the standard keyboard buffer, which is a  circu-
  64.  lar buffer of 2-bytes words.
  65.   This 2-bytes words are in general formed by the ASCII translation in
  66.  the low byte and the scan code in the high byte.  Extended characters
  67.  could have an ASCII translation of 0 or E0  (for the extended 101/102
  68.  keys keyboards) or F0 (other extended chars).   You  can inspect keys
  69.  stored in the keyboard buffer from the standard  INT 9h handler  with
  70.  the program SEEKBBUF.COM (with Turbo-c source).
  71.  
  72.   The way to use KBSTUFF  is simple for c programmers.
  73.   syntax:
  74.   KBSTUFF [/R] <what to stuff>
  75.     /R          Option. If present must be the first parameter, other-
  76.                wise is interpreted as two characters to store.
  77.                 Reset the keyboard's buffer.
  78.     <what to stuff> are the characters to store in the buffer.
  79.                 Blanks and tabs are generally skipped, but you can use
  80.                a C-type string, as, for example,
  81.                  "pippo a:\r"
  82.                  "\r\n\t\aError in C:\\work\r\n"
  83.                  "\76\xFDThis are octal and hexadecimal notation\?"
  84.                 \OOO and \xHHH are accepted as for ANSI C, but if  the
  85.                value of FFh is exceeded only the low byte is  conside-
  86.                red and the high is stripped.
  87.                 With this "normal" use only ASCII translation are sto-
  88.                red, without scan code, as the keys would have been ge-
  89.                nerated with the ALT-key+Keypad numbers combination.
  90.                 My extensions to C-string allow to store extended keys
  91.                with a low byte of 0.
  92.                 To store the word 6800h, for example, many methods can
  93.                be used:
  94.                  "\0\x68","\ex68" (where the escape sequence \e is  an
  95.                  extension to the standard C-string syntax), "\0h"  or
  96.                  "\eh" (where ascii('h')=0x68)
  97.                 The x is used as an escape character for the \e escape
  98.                sequence, so if 7800h(=<ALT 1>) has to be stored can be
  99.                used:
  100.                  "\ex78","\0\x78","\0x" or "\exx"
  101.  
  102.  
  103.   (c) 1996 by Luigi Mancinelli
  104.   manci@alpha.science.unitn.it
  105.  
  106.   Note: If the program has to be recompiled, the tiny model has  to be
  107.  used and the resulting .exe has to be converted in .com (with the DOS
  108.  utility EXE2BIN for example) or the program doesn't work.
  109.  
  110.  
  111. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  112. KBSTUFFR.C - KBSTUFFR.COM == KBSTFRES.ASM - KBSTFRES.COM
  113.    The little assembly TSR KBSTFRES.COM hooks INT 1Ch (user interrupt),
  114.   complying with IBM's INTERRUPT-SHARING PROTOCOL and  stuffs the  key-
  115.   board buffer with the 2-bytes words it finds in his internal buffer.
  116.    This 2-bytes words are in general formed by the ASCII translation in
  117.   the low byte and the scan code in the high byte.  Extended characters
  118.   could have an ASCII translation of 0 or E0  (for the extended 101/102
  119.   keys keyboards) or F0 (other extended chars).   You  can inspect keys
  120.   stored in the keyboard buffer from the standard  INT 9h handler  with
  121.   the program SEEKBBUF.COM (with Turbo-c source).
  122.    A word with value 0 shouldn't never be generated by standard  INT 9h
  123.   handler and so the TSR interprets a 0 in his buffer as a request of a
  124.   pause, and the following word represent for it the number  of  clock-
  125.   ticks to wait.  A 0 as number of ticks is interpreted as 65536.
  126.    Even a word with the high byte equals to 0xFF should never be  gene-
  127.   rated by the standard INT 9h handler and so the TSR  interprets  this
  128.   as a "short pause", the low byte representing the number of thicks, 0
  129.   interpreted again as 65536.
  130.    The KBSTFRES.COM's buffer is a circular buffer similarly to the key-
  131.   board buffer, but it's bigger and could be made even bigger,  alloca-
  132.   ting memory, even if the TSR is already installed.
  133.    The KBSTFRES.COM's companion program KBSTUFFR.COM is  used  to store
  134.   keys in the TSR's buffer.  It could be even used as a scheme for  ad-
  135.   ding other options as allocating another buffer.
  136.  
  137.    The way to use KBSTUFFR is simple for c programmers.
  138.    syntax:
  139.    KBSTUFFR [/R] [/U] [/G] [/S] <what to stuff>
  140.      /R          Option. If present must be the first parameter, other-
  141.                 wise is interpreted as two characters to store.
  142.                  Reset the TSR's buffer.
  143.      /U          Option. If present must be the first parameter, other-
  144.                 wise is interpreted as two characters to store.
  145.                  Whatever follow this option is obviously ignored.
  146.                  Uninstall the TSR and remove it from memory.
  147.           /R and /U options are mutually excluding.    Both must be the
  148.           first option. The use of both is, however, a nonsense.
  149.      /S          Stops the TSR.     |_   Can appear anywhere outside of
  150.      /G          Restarts the TSR.  |   C-strings
  151.      <what to stuff> are the characters to store in the buffer.
  152.                  Blanks and tabs are generally skipped, but you can use
  153.                 a C-type string, as, for example,
  154.                   "pippo a:\r"
  155.                   "\r\n\t\aError in C:\\work\r\n"
  156.                   "\76\xFDThis are octal and hexadecimal notation\?"
  157.                  \OOO and \xHHH are accepted as for ANSI C, but if  the
  158.                 value of FFh is exceeded only the low byte is  conside-
  159.                 red and the high is stripped.
  160.                  With this "normal" use only ASCII translation are sto-
  161.                 red, without scan code, as the keys would have been ge-
  162.                 nerated with the ALT-key+Keypad numbers combination.
  163.                  My extensions to C-string allow to store extended keys
  164.                 with a low byte of 0 and special pause sequences.
  165.                  To store the word 6800h, for example, many methods can
  166.                 be used:
  167.                   "\0\x68","\ex68" (where the escape sequence \e is  an
  168.                   extension to the standard C-string syntax), "\0h"  or
  169.                   "\eh" (where ascii('h')=0x68)
  170.                  The x is used as an escape character for the \e escape
  171.                 sequence, so if 7800h(=<ALT 1>) has to be stored can be
  172.                 used:
  173.                   "\ex78","\0\x78","\0x" or "\exx"
  174.                  To store a pause, the other extension "\pDDDDD" has to
  175.                 be used where DDDDD is a decimal number.   If only "\p"
  176.                 or "\p0" is entered the pause is set to the default  of
  177.                 1 clock-tick.
  178.  
  179.  
  180.  
  181.    (c) 1996 by Luigi Mancinelli
  182.    manci@alpha.science.unitn.it
  183.  
  184.    Note: If the program has to be recompiled, the tiny model has  to be
  185.   used and the resulting .exe has to be converted in .com (with the DOS
  186.   utility EXE2BIN for example) or the program doesn't work.
  187.  
  188.  
  189. ++++++++++++++++++++++++++++++++++++++++++++++++++++
  190. UNINSTKL.C - UNINSTKL.COM == DISKBD.ASM - DISKBD.COM
  191.    The little assembly TSR DISKBD.COM hooks INT 09h  (keyb. interrupt),
  192.   complying with IBM's INTERRUPT-SHARING PROTOCOL and disables the key-
  193.   board accepting only the combination  <CTRL><ALT><LEFT SHIFT><SPACE>,
  194.   which allows to toggle between keyboard enabled and disabled.
  195.    Why one could use a similar program? For example to disable keyboard
  196.   during execution of batch file, or when a keyboard  stuffer, like the
  197.   combination of KBSTFRES.COM and KBSTUFFR, is used and  the user input
  198.   is desired to be temporarily disabled.    In both cases disabling and
  199.   enabling keyboard should be possible from a  batch file to  be really
  200.   useful.
  201.    This is what this program does, allowing to change the state of  the
  202.   previously loaded TSR and even to uninstalling it  (supposing that no
  203.   not IBM's ISP compliant TSR are loaded after it).
  204.  
  205.    syntax:
  206.    UNINSTKL /U  uninstall DISKBD.COM TSR from interrupt chain of inter-
  207.                rupt 09h and remove it from memory.
  208.    UNINSTKL /E  enable keyboard.
  209.    UNINSTKL /D  disable keyboard.
  210.  
  211.    (c) 1996 by Luigi Mancinelli
  212.    manci@alpha.science.unitn.it
  213.  
  214.    Note: If the program has to be recompiled, the tiny model has  to be
  215.   used and the resulting .exe has to be converted in .com (with the DOS
  216.   utility EXE2BIN for example) or the program doesn't work.
  217.  
  218. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  219. KBDOSRES.C - KBDOSRES.COM == KBRESDIS.ASM - KBRESDIS.COM
  220.    The little assembly TSR KBRESDIS.COM hooks INT 21h  (dos functions),
  221.   complying with IBM's INTERRUPT-SHARING PROTOCOL,  and  traps the  dos
  222.   function AH=0Ch,  function that resets  the keyboard and, eventually,
  223.   call a keyboard function.  Many programs use this to prevent  charac-
  224.   ters stored in the keyboard buffer are used and to force a wait for a
  225.   user input.  For example dos format does it when asks user to confirm
  226.   an hard disk format request.
  227.    When you are creating complex  batch files  that use keyboard buffer
  228.   stuffing this could be useful.
  229.    The companion program KBDOSRES allows to toggle the state of the TSR
  230.   between "trap" and "don't trap" and allows to uninstall the TSR too.
  231.  
  232.    syntax:
  233.    KBSTUFFR /U  uninstalls the TSR.
  234.    KBSTUFFR /P[0|1] disables trapping (0) or enables it (1 and default)
  235.  
  236.    (c) 1996 by Luigi Mancinelli
  237.    manci@alpha.science.unitn.it
  238.  
  239.    Note: If the program has to be recompiled, the tiny model has  to be
  240.   used and the resulting .exe has to be converted in .com (with the DOS
  241.   utility EXE2BIN for example) or the program doesn't work.
  242.  
  243.  
  244. ===========================================================================
  245.  
  246. LICENCE
  247. -------
  248.    The files here included can be freely distributed, provided
  249. that they're distributed together, without stripping copyright
  250. informations and without any change (I'd like to get blame for
  251. my own errors and credit only where it is due - as Chris  Dun-
  252. ford says).  Commercial use couldn't be done  without  contact
  253. the author.
  254.  
  255. (c) 1996 by Luigi Mancinelli
  256. E-Mail: manci@alpha.science.unitn.it
  257. Post :
  258.   Luigi Mancinelli
  259.   c/o Laboratori Didattici
  260.   Facoltà di Scienze
  261.   Università degli Studi di Trento
  262.   38050 POVO-TRENTO (TN)
  263.   ITALY
  264.